package com.wujie.hello.spring.cloud.web.admin.fegin.client.impl;

import com.wujie.hello.spring.cloud.web.admin.fegin.client.AdminClient;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author wujie
 * @version 1.0.0:
 * @title AdminClientImpl
 * @Description TODO
 * @dateTime 2020/9/4 15:29
 * @Copyright 2020-2021
 */
@Component
public class AdminClientImpl implements FallbackFactory<AdminClient> {

    @Override
    public AdminClient create(Throwable throwable) {
        return new AdminClient() {
            @Override
            public String sayHi(String port) {
                return "Hi，this is fegin.port is "+port+"! your message is :\"" + port + "\" but request error.fallback; reason was: " + throwable.getMessage();
            }
        };
    }
}
